<template>
  <ManageMenu></ManageMenu>
  <Man></Man>
<!--  搜索功能-->
  <div id="select">
        <el-input  @input="select"
            placeholder="请输入公司名称"
            v-model="input"
            clearable>
        </el-input>
    <el-button @click="select" id="selectid" type="primary">搜索</el-button>
  </div>

  <div>
    <el-table
        :data="company"
        style="width: 100%">
      <el-table-column
          prop="registerTime"
          label="公司创建日期"
          width="180">
      </el-table-column>
      <el-table-column
          prop="name"
          label="公司名称"
          width="180">
      </el-table-column>
      <el-table-column
          prop="website"
          label="公司官网">
      </el-table-column>
      <el-table-column
          prop="count"
          label="公司人数">
      </el-table-column>
      <el-table-column
          prop="introduction"
          label="公司简介">
      </el-table-column>
      <el-table-column
          prop="userinfo.name"
          label="公司法人">
      </el-table-column>
      <el-table-column
          prop="companyType.name"
          label="公司类型">
      </el-table-column>
    </el-table>
    <div>
      <el-pagination
          background
          layout="prev, pager, next"
          :total="total"
          :page-size="size"
          @current-change="changePage"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import ManageMenu from "@/components/menu/ManageMenu";
import instance from "@/utlis/request";

export default {

  components:{
    ManageMenu
  },

  data() {
    return {
      company:[],
      total:1,
      size:10,
      currentPage:1,
      input:'',
    }
  },
  created:function (){
    this.initData();
  },

  methods:{
    select:function (){//关键词搜索
      instance.get("/Manage/keyword",{params:{
        keyword:this.input
        }}).then(res=>{
         // console.log(res.data.data)
          this.company=res.data.data
      })
    },
    changePage(currentPage){//分页
      this.currentPage=currentPage
     instance.get("/Manage/Context/",{params:{
       pageNum:this.currentPage
       }}).then(res=>{
       this.company=res.data.data.records;
       //console.log(this.currentPage)
     })
    },
    initData:function (){
      instance.get("/Manage/Context",{params:{
        pageNum:this.currentPage
            }}
        ).then(res=>{
        this.company=res.data.data.records
        this.total=res.data.data.total
       // console.log(this.total)一共多少条数据
          //console.log(res.data.records)//这就是所有企业的信息的数组
      })
    }
  }
}
</script>

<style scoped>
#select{
    width: 500px;
    margin-left: 200px;
}
#selectid{
  position: absolute;
  left: 750px;
  top: 110px;
}
</style>
